/* 
 * File:   advance_function_pointer.cpp
 * Author: tandaica0612
 *
 * Created on December 30, 2008, 4:49 PM
 */

#include <stdlib.h>
#include <iostream>
using namespace std;
/*
 *Hàm trả lại con trỏ hàm là tinhtong2so2 :((
 */
void hamthunhat(char* xau){
    cout << "Ham thu nhat ---" << xau << endl;
}
void hamthuhai(char* xau){
    cout << "Ham thu hai ---" << xau << endl;
}
void (*tinhtong2so2(char mychar))(char*){
    void (*myfunc)(char*);
    if(mychar == 'x'){
        myfunc = &hamthuhai;
    }else{
        myfunc = &hamthunhat;
    }
    return myfunc;
}
/*
int main(int argc, char** argv) {
    void (*myfunc1)(char*) = tinhtong2so2('x');
    void (*myfunc2)(char*) = tinhtong2so2('a');
    (*myfunc1)("Hello ^^!");
    (*myfunc2)("Hello ^^!");
    return (EXIT_SUCCESS);
}**/
/*
Ham thu hai ---Hello ^^!
Ham thu nhat ---Hello ^^!
 **/
